package com.zpark.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zpark.entity.patients.FirstAidGuides;
import com.zpark.mapper.FirstAidGuidesMapper;
import com.zpark.service.FirstAidGuidesService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class FirstAidGuidesServiceImpl extends ServiceImpl<FirstAidGuidesMapper, FirstAidGuides>
    implements FirstAidGuidesService {

    @Override
    public List<String> getAllCategories() {
        QueryWrapper<FirstAidGuides> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("DISTINCT category");
        return list(queryWrapper).stream()
            .map(FirstAidGuides::getCategory)
            .collect(Collectors.toList());
    }
}